import Vue from 'vue'
import App from './App.vue'
import "./style/reset.less"

Vue.config.productionTip = false
// 6、导入路由对象
import router from "./router/index.js"


// vant组件库的使用
import { Search,Grid,GridItem,List,PullRefresh, Tab, Tabs, Field,Button,Toast,Cell, CellGroup,NavBar,Icon,Uploader,Dialog  } from 'vant';
Vue.use(Button)
Vue.use(Toast)
Vue.use(Cell);
Vue.use(CellGroup);
Vue.use(NavBar);
Vue.use(Icon);
Vue.use(Uploader);
Vue.use(Dialog);
Vue.use(Field);
Vue.use(Tab);
Vue.use(Tabs);
Vue.use(PullRefresh);
Vue.use(List);
Vue.use(Grid);
Vue.use(GridItem);
Vue.use(Search);

// 全局注册组件
import hmInput from "./components/hmInput.vue"
Vue.component("hmInput",hmInput)

import axios from "./utils/request"
// 全局过滤器，拼接图片路径
Vue.filter("joinPath", (val)=>{
  if(!val){return val}
  if(val.indexOf("http") == -1){
    // 没有基础路径 拼接基础路径
    return axios.defaults.baseURL + val;
  }else{
    // 有基础路径直接返回
    return val
  }
})

// 7、把路由对象注入到vue实例中
new Vue({
  router,
  render: h => h(App),
}).$mount('#app')
